package com.lmind.core.gps.publish;

import java.util.concurrent.ConcurrentHashMap;

import com.lmind.core.publish.PublisherRouter;
import com.lmind.core.publish.Subscriber;

public class GroupPublisherRouter extends PublisherRouter<GpsPub> {

	@Override
	protected void onMessage(String name, GpsPub pub) {
		if (pub.getTerminal().getGroup() == null)
			return;
		ConcurrentHashMap<Subscriber<GpsPub>, String> set = subscribers.get(pub.getTerminal().getGroup());
		for (Subscriber<GpsPub> subscriber : set.keySet()) {
			subscriber.feed(name, pub);
		}
	}
}
